package com.css.zfzx.sjcj.modules.hddcB3DrillProjectTable.service.impl;

import cn.afterturn.easypoi.excel.entity.result.ExcelVerifyHandlerResult;
import cn.afterturn.easypoi.handler.inter.IExcelVerifyHandler;
import com.css.bpm.platform.utils.PlatformObjectUtils;
import com.css.zfzx.sjcj.common.excel.util.ActiveFaultEasyExcelVerifyHelper;
import com.css.zfzx.sjcj.modules.hddcB3DrillProjectTable.viewobjects.HddcB3DrillprojecttableVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * <p>钻探调查数据-钻探工程表-属性表管理, Excel导入校验器</p>
 *
 * @author liuhy
 * @date 2021/8/27
 */
@Component
public class DrillingEngineeringTableExcelVerifyHandler implements IExcelVerifyHandler<HddcB3DrillprojecttableVO> {

    private final ActiveFaultEasyExcelVerifyHelper helper;

    @Autowired
    public DrillingEngineeringTableExcelVerifyHandler(ActiveFaultEasyExcelVerifyHelper helper) {
        this.helper = helper;
    }

    @Override
    public ExcelVerifyHandlerResult verifyHandler(HddcB3DrillprojecttableVO vo) {
        ExcelVerifyHandlerResult result = helper.verify(vo);
        if (PlatformObjectUtils.isEmpty(vo.getName()))
            helper.writeNotNullMsg(result, "工程名称");
        if (PlatformObjectUtils.isEmpty(vo.getDrillcount()))
            helper.writeNotNullMsg(result, "钻孔数");
        if (PlatformObjectUtils.isEmpty(vo.getDrilllength()))
            helper.writeNotNullMsg(result, "钻孔总进尺 [米]");
        if (PlatformObjectUtils.isEmpty(vo.getSamplecount()))
            helper.writeNotNullMsg(result, "钻探工程测年送样总数");
        if (PlatformObjectUtils.isEmpty(vo.getDatingsamplecount()))
            helper.writeNotNullMsg(result, "钻探工程获得测试结果样品总数");
        if (PlatformObjectUtils.isEmpty(vo.getDrillinstitute()))
            helper.writeNotNullMsg(result, "钻探单位");
        return result;
    }

}
